import type { RouteItem } from '@/apis/sys/model/menuModel';

/** 助手组件 */
export const assistantComponents = [
  {
    label: '分割线（LcDivider）',
    name: 'lc-divider',
    path: '/demo/lc/divider',
    viewPath: 'assistant/LcDividerView'
  },
  {
    label: '分页器（LcPagination）',
    name: 'lc-pagination',
    path: '/demo/lc/pagination',
    viewPath: 'assistant/LcPaginationView'
  },
  {
    label: '列筛选（LcTableColumnFilter）',
    name: 'lc-table-column-filter',
    path: '/demo/lc/table-column-filter',
    viewPath: 'assistant/LcTableColumnFilterView'
  },
  {
    label: '导航菜单（LcNavMenu）',
    name: 'lc-nav-menu',
    path: '/demo/lc/nav-menu',
    viewPath: 'assistant/LcNavMenuView'
  }
];
/** 高级组件 */
export const advanceComponents = [
  {
    label: '输入框金额（LcInputMoney）',
    name: 'lc-input-money',
    path: '/demo/lc/input-money',
    viewPath: 'advance/LcInputMoneyView'
  },
  {
    label: '图片列表（LcImageList）',
    name: 'lc-image-list',
    path: '/demo/lc/image-list',
    viewPath: 'advance/LcImageListView'
  },
  {
    label: '树形控件（LcTree）',
    name: 'lc-tree',
    path: '/demo/lc/tree',
    viewPath: 'advance/LcTreeView'
  },
  {
    label: '放大镜（LcMagnifier）',
    name: 'lc-magnifier',
    path: '/demo/lc/magnifier',
    viewPath: 'advance/LcMagnifierView'
  },
  {
    label: '卡/账号（LcIcCard）',
    name: 'lc-ic-card',
    path: '/demo/lc/ic-card',
    viewPath: 'advance/LcInputIcCardView'
  },
  {
    label: '身份证号（LcIdentityCard）',
    name: 'lc-identify-card',
    path: '/demo/lc/identify-card',
    viewPath: 'advance/LcInputIdentityCardView'
  },
  {
    label: '手机号（LcPhoneNumber）',
    name: 'lc-phone-number',
    path: '/demo/lc/phone-number',
    viewPath: 'advance/LcPhoneNumberView'
  }
];
/** 表单组件 */
export const formComponents = [
  {
    label: '金额（LcInputAmount）',
    name: 'lc-input-amount',
    path: '/demo/lc/input-amount',
    viewPath: 'form/LcInputAmountView'
  },
  {
    label: '状态（LcStatus）',
    name: 'lc-status',
    path: '/demo/lc/status',
    viewPath: 'form/LcStatusView'
  },
  {
    label: '标签（LcTag）',
    name: 'lc-tag',
    path: '/demo/lc/tag',
    viewPath: 'form/LcTagView'
  },
  {
    label: '滑块（LcSlider）',
    name: 'lc-slider',
    path: '/demo/lc/slider',
    viewPath: 'form/LcSliderView'
  },
  {
    label: 'Excel导入（LcExcelImport）',
    name: 'lc-excel-import',
    path: '/demo/lc/excel-import',
    viewPath: 'form/LcExcelImportView'
  },
  {
    label: 'Excel导出（LcExcelExport）',
    name: 'lc-excel-export',
    path: '/demo/lc/excel-export',
    viewPath: 'form/LcExcelExportView'
  },
  {
    label: '文件上传（LcFile）',
    name: 'lc-file',
    path: '/demo/lc/file',
    viewPath: 'form/LcFileView'
  },
  {
    label: '文本域（LcTextArea）',
    name: 'lc-textarea',
    path: '/demo/lc/textarea',
    viewPath: 'form/LcTextAreaView'
  },
  {
    label: '时间选择（LcTimePicker）',
    name: 'lc-time-picker',
    path: '/demo/lc/time-picker',
    viewPath: 'form/LcTimePickerView'
  },
  {
    label: '日期选择（LcDatePicker）',
    name: 'lc-date-picker',
    path: '/demo/lc/date-picker',
    viewPath: 'form/LcDatePickerView'
  }
];
/** 布局组件 */
export const layoutComponents = [
  {
    label: '步骤条（LcSteps）',
    name: 'lc-steps',
    path: '/demo/lc/steps',
    viewPath: 'layout/LcStepsView'
  },
  {
    label: '窄-宽布局（LcNarrowBoard）',
    name: 'lc-narrow-broad',
    path: '/demo/lc/narrow-broad',
    viewPath: 'layout/LcNarrowBoardView'
  },
  {
    label: '标签导航（LcTabNav）',
    name: 'lc-tab-nav',
    path: '/demo/lc/tab-nav',
    viewPath: 'layout/LcTabNavView'
  },
  {
    label: '列表筛选（LcListFilter）',
    name: 'lc-list-filter',
    path: '/demo/lc/list-filter',
    viewPath: 'layout/LcListFilterView'
  },
  {
    label: '卡片2（LcCard2）',
    name: 'lc-card2',
    path: '/demo/lc/card2',
    viewPath: 'layout/LcCard2View'
  },
  {
    label: '三栏布局（LcThreeColumn）',
    name: 'lc-three-column',
    path: '/demo/lc/three-column',
    viewPath: 'layout/LcThreeColumnView'
  },
  {
    label: '可编辑表格（LcEditorTable）',
    name: 'lc-editor-table',
    path: '/demo/lc/editor-table',
    viewPath: 'layout/LcEditorTableView'
  }
];
const groups = [
  {
    title: '助手组件',
    components: assistantComponents
  },
  {
    title: '高级组件',
    components: advanceComponents
  },
  {
    title: '表单组件',
    components: formComponents
  },
  {
    title: '布局组件',
    components: layoutComponents
  }
];
export default groups;

export const generateRouters = () => {
  const routers: RouteItem[] = [];
  groups.forEach(({ components }) => {
    components.forEach(({ path, name, viewPath }) => {
      routers.push({
        path,
        name,
        component: `../../views/demo/lc-components/${viewPath}.vue`,
        meta: { title: name }
      });
    });
  });
  // 最后一个router总是404，加一个空的
  routers.push({
    name: '000',
    path: '000',
    component: '',
    meta: { title: '' }
  });
  return routers;
};
